<template>
	<view class="mygive">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">我的赠送</block>
		</cu-custom>		
		<view class="head">
			<view>
				<view class='money'>
					<image src="/static/assets.png"></image>
					<view class="cash">赠送金额</view>
					<view class="o-s"><text>&yen;</text>{{ Info.sum_cashback }}</view>
				</view>
			</view>
		</view>
		<view class="title">{{ Info.tis_str }}</view>
		<view class="btn">
			<button type="warn" :disabled="Info.receive_state">一键点击领取</button>
		</view>
		<view class="list" v-for="(item, index) in list" :key="index">
			<view>
				<view>剩余</view>
				<view>{{ item.rest_cashback }}元</view>
			</view>
			<view>
				<view>赠送金额</view>
				<view>{{ item.cashback }}元</view>
			</view>
			<view>
				<button type="warn" :disabled="item.get_state">领取</button>
			</view>
		</view>
	</view>
</template>

<script>
	import { CashBack } from '@/common/api/lbt'
	export default {
		name: 'MyGive',
		data () {
			return {
				Info: {},
				list: []
			}
		},
		onLoad () {
			this.getInfo()
		},
		methods: {
			getInfo () {
				uni.showLoading()
				CashBack().then(res => {
					uni.hideLoading()
					res.sum_cashback = this.utils.Fxied(res.sum_cashback)
					this.Info = res
					this.list = res.cashback_data
				})
			}
		}
	}
</script>

<style lang="less" scoped>
@import '../../common/styles/variables.less';	
.mygive {
	.head {
	background-color:@headBg;
	color:white;
	padding: 50upx 0 50upx;
	& > view {
		display: flex;
		justify-content: center;
		align-items: center;
		.money {
			font-size: @title;
			display: flex;
			flex-flow: column;
			flex-direction: column;
			align-items: center;
			image {
				width: 120upx;
				height: 120upx;
				display: block;
			}
			.cash { }
			.o-s {
				font-size:@title;
				font-weight: bold;
				text {
					font-size:@minSize;
					padding-right: 10upx;
				}
			}
		}
	}
  }
  .title {
	  font-size: @title;
	  text-align: center;
	  padding: 30upx 0;
  }
  .btn {
	  margin: 0 15upx;
  }
  .list {
	  background-color:white;
	  overflow: hidden;
	  margin-top: 20upx;
	  & > view {
		  height: @height;
		  display: flex;
		  justify-content: space-between;
		  align-items: center;
		  padding: 0 15upx;
		  &:not(:last-of-type) {
			  .border-bottom(15upx);
		  }
		  & > view {
			  &:nth-of-type(2) {
				  color: @red;
				  font-weight: 600;
			  }
		  }
		  &:last-of-type {
			  margin: 15upx 0;
		  }
		  & > button {
			  flex: 1;
		  }
	  }
  }
}
</style>
